<!-- 列表组件 -->
<template>
  <div class="list">
    <ul>
      <li v-for="(list, index) in lists" :key="index">
        <div class="img">
          <img :src="list.goods_thumb" alt="" />
        </div>
        <div class="title">{{ list.title }}</div>
        <div class="price">{{ list.shop_price }}</div>
      </li>
    </ul>
      <div class="loading" v-if="isLoading">
      <img src="@/assets/images/loading.gif" alt />
      <span>玩命加载中...</span>
    </div>
       <div style="height:5rem"></div>
  </div>
</template>

<script>
export default {
  //import引入的组件需要注入到components对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {

    };
  },
  props: {
    lists: Array,
    isLoading:Boolean
  },
  methods: {},
};
</script>
<style lang="less">
.list {
  width: calc(100% - 2rem);
  margin-left: 1rem;
      // min-height: 40rem;
  ul {

    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-top: 1rem;
    li {
      width: 48%;
      background: #fff;
      margin-bottom: 1rem;
      border-radius: 1rem;
      overflow: hidden;
      height: 26.5rem;
      img {
        width: 100%;
        height: 17rem;
      }
      .title {
        font-size: 1.4rem;
        height: 4rem;
        font-weight: 500;
        line-height: 2rem;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      .price {
        font-size: 1.6rem;
        font-weight: 700;
        color: rgb(242, 14, 40);
        line-height: 3rem;
        &::before {
          content: "￥";
        }
      }
    }
  }
   .loading {
    width: 100%;
    height: 5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    img {
      width: 5rem;
      height: 5rem;
    }
    span {
      font-size: 1.8rem;
      color: #999;
    }
  }
}
</style>